<!DOCTYPE html>
<html lang="en">
<head>
     <meta charset="UTF-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Document</title>
</head>
<style>
 *{
  margin:0;
  padding:0;
  list-style-type: none;
 }
 
</style>
<script>
  /*json特殊格式的字符串
  js对象表示法*
  json分类
  1.对象
  2.数组
  json中只允许的值
  1.字符串
  2.数值
  3.布尔值
  4.null
  5.普通对象
  6。数组*/
  window.onload=function(){
var obj='{"name":"孙悟空","age":18}';
var arr='[1,2,3]';
var obj1='{"arr":[1,2,3]}';
//json对象字符串转换为对象
var a=JSON.parse(obj);
var b=JSON.parse(arr)
console.log(a.name);
console.log(b[0]);
var obj2={name:"小民",age:18};
var st=JSON.stringify(obj2);
console.log(st);
  }
 </script>
<body>

</body>
</html>                                                                                                                                 